Vue.component('myright',{
    template: `
        <div>
            <!--浏览最多开始-->
          <ul class="list-group">
            <li class="list-group-item list-head">
              <h4>
                <i class="fa fa-eye"> 浏览最多</i>
              </h4>
            </li>
            <li v-for="p in view_arr" class="list-group-item">
              <!-- 左对齐 -->
              <div class="media">
                <div class="media-left">
                  <a :href="'/detail.html?id='+p.id">
                    <img :src="p.url" class="media-object" style="width:60px;height: 40px">
                  </a>
                </div>
                <div class="media-body">
                    <h4 class="media-heading">
                      <a :href="'/detail.html?id='+p.id">
                        {{p.title}}
                      </a>
                    </h4>
                  <p>{{p.author}}</p>
                </div>
              </div>
            </li>
          </ul>
          <!--浏览最多结束-->
          <!--最受欢迎开始-->
          <ul class="list-group">
            <li class="list-group-item list-head">
              <h4>
                <i class="fa fa-thumbs-o-up"> 最受欢迎</i>
              </h4>
            </li>
            <li v-for="l in like_arr" class="list-group-item">
              <!-- 左对齐 -->
              <div class="media">
                <div class="media-left">
                  <a :href="'/detail.html?id='+l.id">
                    <img :src="l.url" class="media-object" style="width:60px;height: 40px">
                  </a>
                </div>
                <div class="media-body">
                  <h4 class="media-heading">
                    <a :href="'/detail.html?id='+l.id">
                      {{l.title}}
                    </a>
                  </h4>
                  <p>{{l.author}}</p>
                </div>
              </div>
            </li>
          </ul>
          <!--最受欢迎结束-->
        </div>
    `,
    data:function () {
        return {
            view_arr:[],
            like_arr:[]
        }
    },
    created:function () {
        let v = this;
        // 请求浏览最多
        axios.get("/product/select/view").then(function (response) {
            v.view_arr = response.data;
        })
        // 请求最受欢迎
        axios.get("/product/select/like").then(function (response) {
            v.like_arr = response.data;
        })
    }
})
let right_v = new Vue({
    el:"myright",

})